import {SimpleModel} from "../../framework/model/SimpleModel.ts";
import * as THREE from 'three'
import type {Material} from "three";

export class Demo1 extends SimpleModel {

    plant_width: number
    plant_height: number
    thickness: number
    material: Material
    materialRed: Material
    mesh: THREE.Mesh

    constructor() {
        super("Demo1")
        this.material = new THREE.MeshPhongMaterial({color: 0xffff00, depthWrite: false})
        this.materialRed = new THREE.MeshPhongMaterial({color: 0xff0000, depthWrite: false})
    }

    init(plant_width, plant_height, thickness,color) {
        this.mesh = new THREE.Mesh(
            new THREE.BoxGeometry(plant_width, plant_height, thickness),
            this.material
        )
        this.scene?.add(this.mesh)
        let left = new THREE.Mesh(
            new THREE.BoxGeometry(thickness, plant_height, thickness*16),
            this.material
        )
        left.position.setX(-plant_width/2)
        left.position.setZ(thickness*16/2)
        left.material = this.materialRed
        this.scene.add(left)
    }
}
